require File.dirname(__FILE__) + '/freeze'
require File.dirname(__FILE__) + '/create-snapshot'

def change_api_log_dir
  Dir.chdir(File.dirname(__FILE__))
end

backup_volume = BackupVolume.new

backup_volume.clean_temp_files()

do_freeze(backup_volume)
change_api_log_dir()

nickname = ARGV[0]
description = ARGV[1]
volume_id = ARGV[2]
timeout = ARGV[3].to_i

EBSSnapshot.new(timeout).create_snapshot(nickname, description, volume_id)
backup_volume.unfreeze()

backup_volume.clean_temp_files()


